package com.google.code.mybatis.generator.plugins.gen;

import com.google.code.mybatis.generator.plugins.gen.Blog;
import com.google.code.mybatis.generator.plugins.gen.BlogExample;
import java.util.List;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

@CacheNamespace(
implementation=org.mybatis.caches.ehcache.LoggingEhcache.class
)
public interface BlogMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_BLOG
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @SelectProvider(type=BlogSqlProvider.class, method="countByExample")
    int countByExample(BlogExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_BLOG
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @DeleteProvider(type=BlogSqlProvider.class, method="deleteByExample")
    int deleteByExample(BlogExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_BLOG
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @Delete({
        "delete from T_BLOG",
        "where ID = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_BLOG
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @Insert({
        "insert into T_BLOG (NAME, URL, ",
        "DESCRIPTION, OWNER_ID)",
        "values (#{name,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, ",
        "#{description,jdbcType=VARCHAR}, #{ownerId,jdbcType=BIGINT})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(Blog record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_BLOG
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @InsertProvider(type=BlogSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insertSelective(Blog record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_BLOG
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @SelectProvider(type=BlogSqlProvider.class, method="selectByExampleDecorated")
    @Results({
        @Result(column="ID", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="NAME", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="URL", property="url", jdbcType=JdbcType.VARCHAR),
        @Result(column="DESCRIPTION", property="description", jdbcType=JdbcType.VARCHAR),
        @Result(column="OWNER_ID", property="ownerId", jdbcType=JdbcType.BIGINT)
    })
    List<Blog> selectByExampleDecorated(BlogExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_BLOG
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @SelectProvider(type=BlogSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="ID", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="NAME", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="URL", property="url", jdbcType=JdbcType.VARCHAR),
        @Result(column="DESCRIPTION", property="description", jdbcType=JdbcType.VARCHAR),
        @Result(column="OWNER_ID", property="ownerId", jdbcType=JdbcType.BIGINT)
    })
    List<Blog> selectByExample(BlogExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_BLOG
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @Select({
        "select",
        "ID, NAME, URL, DESCRIPTION, OWNER_ID",
        "from T_BLOG",
        "where ID = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="ID", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="NAME", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="URL", property="url", jdbcType=JdbcType.VARCHAR),
        @Result(column="DESCRIPTION", property="description", jdbcType=JdbcType.VARCHAR),
        @Result(column="OWNER_ID", property="ownerId", jdbcType=JdbcType.BIGINT)
    })
    Blog selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_BLOG
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @UpdateProvider(type=BlogSqlProvider.class, method="updateByExampleSelective2")
    int updateByExampleSelective2(@Param("record") Blog record, @Param("example") BlogExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_BLOG
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @UpdateProvider(type=BlogSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Blog record, @Param("example") BlogExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_BLOG
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @UpdateProvider(type=BlogSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Blog record, @Param("example") BlogExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_BLOG
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @UpdateProvider(type=BlogSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Blog record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table T_BLOG
     *
     * @mbggenerated Wed Nov 30 10:19:04 CET 2011
     */
    @Update({
        "update T_BLOG",
        "set NAME = #{name,jdbcType=VARCHAR},",
          "URL = #{url,jdbcType=VARCHAR},",
          "DESCRIPTION = #{description,jdbcType=VARCHAR},",
          "OWNER_ID = #{ownerId,jdbcType=BIGINT}",
        "where ID = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(Blog record);
}